{% extends base %}

{% block head %}

<style>
    .td-no {
        width: 50px;
    }

    .label {
        width: 150px;
        text-align: right;
        display: table-cell;
    }
</style>

{% end %}

{% block body_left %}

<div class="card">

    <h3 class="card-title btn-line-height">
        <a class="link2" href="/system/user/list">用户管理</a>&nbsp;/&nbsp;<span>编辑</span>
        {% include common/back.html %}
    </h3>

</div>

<div class="card">

<form method="POST" class="col-md-12" action="/system/user">

{% if user_info != None %}
    <input type="hidden" name="name" value="{{user_info.name}}">
    <table class="table col-md-12">
        <tr>
            <td class="label">用户名</td>
            <td>{{user_info.name}}</td>
        </tr>
        <tr>
            <td class="label">密码</td>
            <td>
                <input name="password" type="password" value="{{user_info.password}}">
                <a class="show-password-link" data-value="{{user_info.password}}">查看</a>
            </td>
        </tr>
        <tr>
            <td class="label">salt</td>
            <td>{{user_info.salt}}</td>
        </tr>
        <tr>
            <td class="label">token</td>
            <td>{{user_info.token}}</td>
        </tr>
        <tr>
            <td class="label">上次更新</td>
            <td>{{user_info.mtime}}</td>
        </tr>
        <tr>
            <td class="label">上次登录</td>
            <td>{{user_info.login_time}}</td>
        </tr>
    </table>
    <input type="submit" value="更新用户">
    {% if user_info.name != "admin" %}
        <input class="btn-danger delete-user-btn" type="button" data-name="{{user_info.name}}" value="删除用户">
    {% end %}
{% else %}
    <table class="table col-md-12">
        <tr>
            <td class="label">用户名</td>
            <td><input name="name"></td>
        </tr>
        <tr>
            <td class="label">密码</td>
            <td><input name="password" value=""></td>
        </tr>
    </table>
    <input type="submit" value="新增用户">
{% end %}

</div>

{% include user/component/user_script.html %}

{% end %}
